<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8" />
    <title>array操作</title>
    <script>
        var arr = ["11", "22", "33", "44"];

        //访问数组元素  数组名[索引值]  如果索引存在，返回对应索引的元素，如果索引不存在，就会返回undefined
        // console.log(arr[10]);

        //根据索引修改数组元素
        // arr[0] = "111";
        // console.log(arr[0]);

        /* var arr2 = [];
        arr2[0] = "11";
        arr2[1] = "22";

        console.log(arr2); */


        //遍历就是将数组的元素，依次取出，进行处理
        /* console.log(arr[0]);
        console.log(arr[1]);
        console.log(arr[2]);
        console.log(arr[3]); */

        for (var i = 0; i < arr.length; i++) {
            console.log(arr[i]);
        }


    </script>
</head>

<body>
</body>